package com.xyh.transaction.mapper;

import com.xyh.transaction.entity.Permission;
import com.xyh.transaction.entity.Role;
import com.xyh.transaction.entity.dto.role.RoleSearchDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Collection;
import java.util.List;
import java.util.Set;

@Mapper
public interface RoleMapper {

    List<Integer> findMenuIdListByRoleId(Integer roleId);

    List<Role> findAll(RoleSearchDto roleSearchDto);

    Integer updateRole(Role role);

    Integer deleteRole(@Param("ids") Integer[] ids);

    Set<Permission> findPermissionById(Integer roleId);

    Integer deleteRolePermission(Integer roleId);

    Integer deleteRoleRoute(Integer roleId);

    Integer insertRolePermission(@Param("roleId") Integer roleId,@Param("permissions") Set<Integer> permissions);

    Integer insertRoleRoute(@Param("roleId")Integer roleId,@Param("routes") Set<Integer> routes);

    Integer insert(Role role);

    Set<Role> findRoleByUserId(Integer userId);

    Set<Role> findByNames(Collection<String> roleNames);
}
